package com.dodi.spring.cyclicReference;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.w3c.dom.Element;

public class Main {

	public static void main(String[] args) throws Throwable {
	
		try {
			ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("cyclicReference/applicationContext-setter.xml");			
			System.out.println(ac.getBean("a"));
			System.out.println("11");
		} catch (Exception e) {
			Throwable e1 = e.getCause().getCause().getCause();
			throw e1;
		}
	}
	
	@Test
	public void testCirclePrototype() throws Throwable {
		try {
			ClassPathXmlApplicationContext cx = new ClassPathXmlApplicationContext("cyclicReference/applicationContext-prototype.xml");
			System.out.println(cx.getBean("a"));
		} catch (Exception e) {
			Throwable e1 = e.getCause().getCause().getCause();
			throw e1;
		}
	}
	@Test
	public void testContraster() throws Throwable {
		
		try {
			ClassPathXmlApplicationContext cx = new ClassPathXmlApplicationContext("cyclicReference/applicationContext.xml");
			System.out.println(cx.getBean("a"));
		} catch (Exception e) {
			Throwable e1 = e.getCause().getCause().getCause();
			throw e1;
		}
	}
	
}
